<!doctype html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" th:href="@{/img/favicons/favicon.ico}">

    <title>Dashboard Template for Bootstrap</title>

    <!-- Bootstrap core CSS -->
    <link th:href="@{/css/bootstrap.min.css}" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link th:href="@{/css/dashboard.css}" rel="stylesheet">
  </head>

  <body>

    <div th:insert="~{common/common::topbar}"></div>

    <div class="container-fluid">
      <div class="row">

        <div th:insert="~{common/common::sidebar(active='emps')}"></div>
        <main role="main" class="col-md-9 ml-sm-auto col-lg-10 pt-3 px-4">
          <h2>Section title</h2>
          <div class="table-responsive">
            <table class="table table-striped table-sm">
              <thead>
                <tr>
                  <th>ID</th>
                  <th>LastName</th>
                  <th>Email</th>
                  <th>Gender</th>
                  <th>Department</th>
                  <th>Birth</th>
                  <th>Option</th>
                </tr>
              </thead>
              <tbody>
                <tr th:each="emp:${emps}">
                  <td th:text="${emp.getId()}"></td>
                  <td th:text="${emp.getLastName()}"></td>
                  <td th:text="${emp.getEmail()}"></td>
                  <td th:text="${emp.getGender()}"></td>
                  <td th:text="${emp.getDpt().getDepartmentName()}"></td>
                  <td th:text="${#dates.format(emp.getBirth(), 'yyyy-MM-dd')}"></td>
                  <td>
                    <a class="btn btn-sm btn-primary" th:href="@{/update/}+${emp.getId()}">Edit</a>
                    <a class="btn btn-sm btn-danger" th:href="@{/delete/}+${emp.getId()}">Delete</a>
                  </td>

                </tr>
              </tbody>
            </table>
            <div><a class="btn btn-sm btn-success" th:href="@{/emp}">Add</a></div>
          </div>
        </main>
      </div>
    </div>

    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script th:src="@{/js/vendor/jquery-slim.min.js}" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
    <script>window.jQuery || document.write('<script th:src="@{/js/vendor/jquery-slim.min.js}"><\/script>')</script>
    <script th:src="@{/js/vendor/popper.min.js}"></script>
    <script th:src="@{/js/bootstrap.min.js}"></script>

    <!-- Icons -->
    <script th:src="@{/js/feather.min.js}"></script>
    <script>
      feather.replace()
    </script>


  </body>
</html>
